#! /usr/bin/env python
#coding=utf-8
import tgame_fsm

class PlayerFSMClass(tgame_fsm.IFsmCallbackObj):
	TransitionMap = {
		   ('stand', 'onMove'):'move',
		   ('move', 'stopMove'):'stand',
		   ('stand', 'Fire'):'atk',
	}
	MapState2Look = {
		  'move' : 'anim_stand_clip1',
		  'walk' : 'anim_walk_clip1',
		  'run' : 'anim_run_clip1',
		  'float' : 'anim_float_clip1',
	}
	def __init__(self):
		self.fsm = tgame_fsm.CFsm(TransitionMap, self)
		#self.sprite = # load some super cool model2d

	def OnEvent(self, event):
		self.fsm.OnEvent(event)

	def OnEnterState(self, state):
		  # 比如进入某状态就切换到对应的动画
		  self.sprite.change_looks(MapState2Look[state])

	def OnLeaveState(self, state):
		pass

	def OnEvent(self, state, event):
		pass
